<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    var arr = [1, 2, 3, 60]
    var arr2 = [1, 2, 3]
    var flag = 0
    function has(a, val) {
        for (let i = 0; i < a.length; i++) {
            if (a[i] !== val) {
                flag++
                if (flag === a.length) {
                    return false
                }
            } else {
                return true
            }
        }
    }
    console.log(has(arr, 60))
    console.log(has(arr, 60))

</script>

</html>